<?php
include "includeFiles.php";
include "page.php";
//if(empty($_SESSION['user_id'])) echo "<script>location.href='login.php';<//script>";

 function unsetArray($array,$delarr){
		foreach ($array as $bkey=>$bvalue){
			foreach ($delarr as $key=>$value){
				if($value == $bkey){
				unset($array[$bkey]);		
			    }
		     }
	    }
		return $array;
	}


function insert($arr,$table){
    	if($arr){
    		foreach ($arr as $key=>$value){
    			@$fild[]  = "`".$key."`";
    			@$vals[]  = "'".$value."'";
    		}
    	}
    	$fild = implode($fild,",");
    	$vals = implode($vals,",");
    	return @$sql  =" insert into ".$table."(".$fild.")values(".$vals.")";
    }
	
	
	function update($arr,$table,$where){
		$str="UPDATE `$table` SET ";
		foreach ($arr as $key=>$value){
			$str_key.="`".$key."`='".$value."',";
		}
		$str_key=substr($str_key,0,-1);
		foreach ($where as $key=>$value){
			$sql_where.="`$key`"."='".$value."' AND";
		}
		$sql_where=substr($sql_where,0,-4);
		return $sql_update=$str.$str_key." WHERE ".$sql_where.";";
		
	}
	

if($_POST['action'] == 'del'){
	 $strs = implode(',',$_POST['ID']);
	 $sql = "delete  from  `hy_b_3g` WHERE  SpecialCateID in ($strs) ";
     $msg = $objDb->query($sql);
     if($msg) $objBase->popup("删除成功！"); else $objBase->popup("删除失败！"); 
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $C['Title'];?></title>
<Link href="../uploadfile/ico/<?php echo $C['ICO'];?>" rel="Shortcut Icon">
<meta name="Keywords" content="<?php echo $C['Keywords'];?>">
<meta name="description" content="<?php echo $C['Description'];?>">
<Meta name="Copyright" Content="<?php echo $C['CopyRight'];?>">
<link href="css/css.css" rel="stylesheet" type="text/css" />
<link charset="utf-8" rel="stylesheet" href="css/alipay.css">
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
</head>
<body id="mainbody">
<?php include_once('header.php');?>
<!--主体布局-->
<div class="main">
  <div class="locahostDIv"> <span>当前位置：<a href="index.php&cityid=<?=$cityid?>">首页</a></span> >
  <?
   if($keyword)	{ echo "搜索中"; }else{
  
  ?>
   <a href="on.php?hid=110&cityid=<?=$cityid?>">2G号码套包</a> > <a href="on.php?cateid=<?=$cateid?>&cityid=<?=$cityid?>"><?=$alink=$info->getProLinks($cateid)?></a> 
   <? }?>
   
   </div>
  <div class="contant">
    <div class="left">
      <div class="fen">
        <div class="box">
          <div class="tital">
            <div class="tit"><em>产品分类</em></div>
          </div>
          <div class="main2">
            <div class="sorttab">
              <ul class="tab">
	<?php	
	$vm=$info->getProMenu(110);
	if($vm){
	foreach($vm as $key=>$value){
	 ?>
        <li class="l1"><a href="on.php?cateid=<?=$value['SysProCategoryID']?>&cityid=<?=$cityid?>"><?=$value['CateName']?></a></li>
            <? }}?>
              </ul>
            </div>
          </div>
        </div>
        <div class="bot"></div>
      </div>
    </div>
    <div class="right">
      <div class="about2">
        <div class="box">
          <div class="main1">
              <div class="pageInfo">
             <?php
                $sql = "SELECT * FROM `hy_b_3g` WHERE  1  ";
				$result = mysql_query($sql);
				$total = mysql_num_rows($result);
				//调用pageft()，每页显示10条信息（使用默认的20时，可以省略此参数），使用本页URL（默认，所以省略掉）。
				_PAGEFT($total,20);
			    echo "筛选结果总和:".$total;
				$SQL2 = $sql." order by `SpecialCateID` DESC limit $firstcount,$displaypg  ";
				$objDb->query($SQL2);
		        $result = $objDb->get_data();
	        ?>
            <form action="#" method="post" name="form1" onsubmit="return abc();"> 
                <table class='datalist'><tr id='first'><td>
                <input name="action" type="hidden" value="del" > 
                <input type="button" value="全选/全不选" id="unSelect"> 
                </td><td>编号</td><td>运营商编码</td><td> 电话号码</td><td> 运营商编码</td><td>号码级别 号码销售价格</td></tr>
            <?php
				if(empty($total)) echo "<tr><Td colspan=\"6\"><center>对不起！资料暂时为空！</center></td></tr>";
				if($result){
				 foreach($result as $key=>$value){
				?>
                   <tr id="content">
                   <td><input name="ID[]"  id="ID[]" type="checkbox" value="<?php echo $value['SpecialCateID'];?>" /></td>
                   <td><a href="3g_add.php?id=<?=$value['SpecialCateID']?>"><?php echo $value['tele_code'];?></a></td>
                   <td ><?=$value['Serial_number']?></a></td></td>
                   <td><?=$value['CustomLink']?></td>
                   <td><?=$value['remarks']?></td>
                   <td><?=$value['Serial_level ']?></td>
                   </tr>
				
                 <?
				  } }
	           
?>
 </table>
 <input type="submit" id="submit" value="批量删除">  
</form>  
              
  <script language="javascript">
   
//反选事件
     $("#unSelect").click(function(){
         var checkbox=$(":checkbox");
         for(var i=0;i<checkbox.length;i++){
             checkbox[i].checked=!checkbox[i].checked;
         }
     });
	 
function abc(){
	 if(confirm(' \n您是否确定删除该纪录?')){
		 return true;

	  }else{
		  alert('取消成功！');
		  return false;
	  }
}

</script>
            
            </div>            
          
          </div>
        </div>
		<div align="center"> <?php  echo $pagenav; ?></div>
        <div class="bot"></div>
      </div>
    </div>
  </div>
  <div class="gehang"></div>
  <div style="width:980px;height:100%;overflow:hidden;margin-top:10px"> <img src="images/copy_line.jpg" /><br />
    <br />
    <br />
    <img src="images/copy.jpg" />
    <?php include_once('help.php');?>
    <img src="images/copy_line.jpg" /> </div>
</div>
<div class="clear"></div>
<?php include_once('footer.php');?>

</body>
</html>
